<template>
  <div>
    <RecordListVue v-if="currentType == 1"></RecordListVue>
    <RecordListManageVue v-else-if="currentType == 2"></RecordListManageVue>
    <template v-else>
      <div></div>
    </template>
  </div>
</template>

<script>
  import RecordListVue from './recordList.vue'
  import RecordListManageVue from './recordListManage.vue'
  import { getRuleList } from '@/api/quality.js'
  export default {
    name: 'quality',
    data() {
      return {
        currentType: null
      }
    },
    components: {
      RecordListVue,
      RecordListManageVue
    },
    methods: {},
    created() {
      this.currentType = this.$route.query.type
      if (!this.currentType) {
        getRuleList({ manageUserId: sessionStorage.getItem('userId') }).then((res) => {
          if (res.rows && res.rows.length) {
            this.currentType = 2
          } else {
            this.currentType = 1
          }
        })
      }
    }
  }
</script>

<style scoped></style>
